---
title:  Basic Querying
---

<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

This section provides a high-level introduction to Geode querying such as building a query string and describes query language features.

<a id="querying_with_oql__section_828A9660B5014DCAA883A58A45E6B51A"></a>
Geode provides a SQL-like querying language that allows you to access data stored in Geode regions. Since Geode regions are key-value stores where values can range from simple byte arrays to complex nested objects, Geode uses a query syntax based on OQL (Object Query Language) to query region data. OQL and SQL have many syntactical similarities, however they have significant differences. For example, while OQL does not offer all of the capabilities of SQL like aggregates, OQL does allow you to execute queries on complex object graphs, query object attributes and invoke object methods.

The syntax of a typical Geode OQL query is:

``` pre
[IMPORT package]
SELECT [DISTINCT] projectionList
FROM collection1, [collection2, …]
[WHERE clause]
[ORDER BY order_criteria [desc]]
```

Therefore, a simple Geode OQL query resembles the following:

``` pre
SELECT DISTINCT * FROM /exampleRegion WHERE status = ‘active’
```

An important characteristic of Geode querying to note is that by default, Geode queries on the values of a region and not on keys. To obtain keys from a region, you must use the keySet path expression on the queried region. For example, `/exampleRegion.keySet`.

For those new to the Geode querying, see also the [Geode Querying FAQ and Examples](../../getting_started/querying_quick_reference.html#reference_D5CE64F5FD6F4A808AEFB748C867189E).

-   **[Advantages of OQL](../../developing/querying_basics/oql_compared_to_sql.html)**

-   **[Writing and Executing a Query in Geode](../../developing/querying_basics/running_a_query.html)**

-   **[Building a Query String](../../developing/querying_basics/what_is_a_query_string.html)**

-   **[OQL Syntax and Semantics](../../developing/query_additional/query_language_features.html)**

-   **[Query Language Restrictions and Unsupported Features](../../developing/querying_basics/restrictions_and_unsupported_features.html)**


